<html><head><title>api.system.utils.ScriptLoader</title><link rel="stylesheet" type="text/css" href="../../../styles/main.css"><link rel="stylesheet" type="text/css" href="../../../styles/prettify.css"><script language=JavaScript src="../../../javascript/prettify.js"></script><script language=JavaScript src="../../../javascript/main.js"></script></head><body class="FramedContentPage" onLoad="{NDOnLoad();prettyPrint();}"><script language=JavaScript><!--
if (browserType) {document.write("<div class=" + browserType + ">");if (browserVer) {document.write("<div class=" + browserVer + ">"); }}// --></script>

<!--  Generated by Natural Docs, version 1.4 -->
<!--  http://www.naturaldocs.org  -->

<!-- saved from url=(0026)http://www.naturaldocs.org -->




<div id=Content><div class="CClass"><div class=CTopic id=MainTopic><h1 class=CTitle><a name="api.system.utils.ScriptLoader"></a>api.<wbr>system.<wbr>utils.<wbr>ScriptLoader</h1><div class=CBody><p>Utility class reposible for chained loading of external scripts.</p><h4 class=CHeading>usage</h4><blockquote><pre class="prettyprint">var loader = new api.system.utils.ScriptLoader();
loader.apiRootPath = './somethingElse'; // changes the root path which first will
                                        // be searched for loading given relative or namespaced script
loader.sourcePaths = ['./myOtherAPI', 'http://myRemoteAPI/'];
loader.get('myapi.MyScript');
loader.get('myotherapi.myinnerFolder.MyNextScript');
loader.get('./relativePath/Script.js');
loader.get('http://domain.com/remote/Script.js').onloadComplete = function() { // at final get you can hook
    alert('all scripts are loaded');
}</pre></blockquote><h4 class=CHeading>loading minified &amp; optimized versions</h4><blockquote><pre class="prettyprint">loader.setUseMinifier(true);</pre></blockquote><h4 class=CHeading>The above will trigger loader to use integrated php script located at /utils/minifier/jsrequire.php which</h4><ul><li>reads all &lt;api.system.utils.Class.require&gt; statements</li><li>returns minified combined version of the requested script &amp; its dependencies.</li></ul><!--START_ND_SUMMARY--><div class=Summary><div class=STitle>Summary</div><div class=SBorder><table border=0 cellspacing=0 cellpadding=0 class=STable><tr class="SMain"><td class=SEntry><a href="#api.system.utils.ScriptLoader" >api.<wbr>system.<wbr>utils.<wbr>ScriptLoader</a></td><td class=SDescription>Utility class reposible for chained loading of external scripts.</td></tr><tr class="SGroup SIndent1"><td class=SEntry><a href="#api.system.utils.ScriptLoader.Functions" >Functions</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#api.system.utils.ScriptLoader.setEnableCache" id=link1 onMouseOver="ShowTip(event, 'tt1', 'link1')" onMouseOut="HideTip('tt1')">setEnableCache</a></td><td class=SDescription>if set enabled = true then on the head tags won&rsquo;t be appended no-cache param</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#api.system.utils.ScriptLoader.getEnableCache" id=link2 onMouseOver="ShowTip(event, 'tt2', 'link2')" onMouseOut="HideTip('tt2')">getEnableCache</a></td><td class=SDescription>returns boolean</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#api.system.utils.ScriptLoader.setMinifier" >setMinifier</a></td><td class=SDescription></td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#api.system.utils.ScriptLoader.getMinifier" >getMinifier</a></td><td class=SDescription>returns boolean</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#api.system.utils.ScriptLoader.findScriptRoot" id=link3 onMouseOver="ShowTip(event, 'tt3', 'link3')" onMouseOut="HideTip('tt3')">findScriptRoot</a></td><td class=SDescription>searched for the root folder of the all defined within apiRootPath and sourcePaths.</td></tr><tr class="SFunction SIndent2"><td class=SEntry><a href="#api.system.utils.ScriptLoader.scriptExists" id=link4 onMouseOver="ShowTip(event, 'tt4', 'link4')" onMouseOut="HideTip('tt4')">scriptExists</a></td><td class=SDescription>Checks if given script within given scriptPath exists by sending HEAD request to the scriptPath</td></tr><tr class="SFunction SIndent2 SMarked"><td class=SEntry><a href="#api.system.utils.ScriptLoader.get" id=link5 onMouseOver="ShowTip(event, 'tt5', 'link5')" onMouseOut="HideTip('tt5')">get</a></td><td class=SDescription>Retrieves script by firstly checking if the script is external, relative or should be searched within defined apiRootPath and sourcePath directories</td></tr></table></div></div><!--END_ND_SUMMARY--></div></div></div>

<div class="CGroup"><div class=CTopic><h3 class=CTitle><a name="api.system.utils.ScriptLoader.Functions"></a>Functions</h3></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="api.system.utils.ScriptLoader.setEnableCache"></a>setEnableCache</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>setEnableCache : function(</td><td class=PParameter nowrap>value</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>if set enabled = true then on the head tags won&rsquo;t be appended no-cache param</p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="api.system.utils.ScriptLoader.getEnableCache"></a>getEnableCache</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td>getEnableCache : function()</td></tr></table></blockquote><p>returns boolean</p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="api.system.utils.ScriptLoader.setMinifier"></a>setMinifier</h3><div class=CBody><h4 class=CHeading>parameters</h4><table border=0 cellspacing=0 cellpadding=0 class=CDescriptionList><tr><td class=CDLEntry>minifierPath</td><td class=CDLDescription>boolean</td></tr></table></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="api.system.utils.ScriptLoader.getMinifier"></a>getMinifier</h3><div class=CBody><p>returns boolean</p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="api.system.utils.ScriptLoader.findScriptRoot"></a>findScriptRoot</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>findScriptRoot : function(</td><td class=PParameter nowrap>script</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>searched for the root folder of the all defined within apiRootPath and sourcePaths.</p><p>starts searching within apiRootPath first.</p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="api.system.utils.ScriptLoader.scriptExists"></a>scriptExists</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>scriptExists : function(</td><td class=PParameter nowrap>scriptPath</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Checks if given script within given scriptPath exists by sending HEAD request to the scriptPath</p></div></div></div>

<div class="CFunction"><div class=CTopic><h3 class=CTitle><a name="api.system.utils.ScriptLoader.get"></a>get</h3><div class=CBody><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>get : function(</td><td class=PParameter nowrap>script,</td></tr><tr><td></td><td class=PParameter nowrap>update</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote><p>Retrieves script by firstly checking if the script is external, relative or should be searched within defined apiRootPath and sourcePath directories</p><h4 class=CHeading>returns</h4><p>Object.onloadComplete which can be overriden for hooking into when load completes</p></div></div></div>

</div><!--Content-->



<!--START_ND_TOOLTIPS-->
<div class=CToolTip id="tt1"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>setEnableCache : function(</td><td class=PParameter nowrap>value</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>if set enabled = true then on the head tags won&rsquo;t be appended no-cache param</div></div><div class=CToolTip id="tt2"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td>getEnableCache : function()</td></tr></table></blockquote>returns boolean</div></div><div class=CToolTip id="tt3"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>findScriptRoot : function(</td><td class=PParameter nowrap>script</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>searched for the root folder of the all defined within apiRootPath and sourcePaths.</div></div><div class=CToolTip id="tt4"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>scriptExists : function(</td><td class=PParameter nowrap>scriptPath</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Checks if given script within given scriptPath exists by sending HEAD request to the scriptPath</div></div><div class=CToolTip id="tt5"><div class=CFunction><blockquote><table border=0 cellspacing=0 cellpadding=0 class=Prototype><tr><td><table border=0 cellspacing=0 cellpadding=0><tr><td class=PBeforeParameters nowrap>get : function(</td><td class=PParameter nowrap>script,</td></tr><tr><td></td><td class=PParameter nowrap>update</td><td class=PAfterParameters nowrap>)</td></tr></table></td></tr></table></blockquote>Retrieves script by firstly checking if the script is external, relative or should be searched within defined apiRootPath and sourcePath directories</div></div><!--END_ND_TOOLTIPS-->

<script language=JavaScript><!--
if (browserType) {if (browserVer) {document.write("</div>"); }document.write("</div>");}// --></script></body></html>